#pragma once

#include <QObject>

class QWebSocket;
class Client;
class Task;
class Session
{
public:
    Session();
    ~Session();
public:
    // convenient calls
    void close() const;
    void activate() const;
public:
    // mehtods
    void send(const QString &type, const QVariantMap &arg) const;
    void send(const QString &type) const;
    int channel() const{ return _channel; }
public:
    static int newChannel(){ return _lastUnusedChannel++; }
    void _send(const QString &text) const;
private:
    // internal variables
    QWebSocket *_client;
    int _channel;
private:
    // internal static variables
    static int _lastUnusedChannel;
};

